package ar.fiuba.fallar2.pac_man.utils;

import ar.fiuba.fallar2.pac_man.AbstractCelda;


public class Matriz {
       
    	private AbstractCelda matriz[][];
       
        public Matriz(int N,int M){
                if (N<0 || M<0){
                        throw new RuntimeException();
                }
               
                this.matriz = new AbstractCelda[N][M];
        }

        public void agregar(AbstractCelda micelda, int i, int j)  {
               
               
                if ((i >this.getFilas()) || (j > this.getColumnas())){

               
                        throw new RuntimeException();
                }
               
                this.matriz[i][j]=micelda;
               
        }

        public int getFilas() {
               
                return this.matriz.length;
        }

        public int getColumnas() {
               
                return this.matriz[0].length;
        }

        public AbstractCelda getCelda(int i, int j) {
                if ((i >=this.getFilas()) || (i < 0) || (j >=this.getColumnas()) || (j < 0)){
                   throw new RuntimeException();
                }
               
                return this.matriz[i][j];
        }
       
       

}

